home *** CD-ROM | disk | FTP | other *** search
/ Shareware for Windows / Trust Shareware CD.iso / winshare / vb / mlist / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-11-26  |  16.8 KB  |  537 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Multi-Column Demo"
  4.    ClientHeight    =   4404
  5.    ClientLeft      =   468
  6.    ClientTop       =   1788
  7.    ClientWidth     =   8592
  8.    FontBold        =   0   'False
  9.    FontItalic      =   -1  'True
  10.    FontName        =   "MS Sans Serif"
  11.    FontSize        =   12
  12.    FontStrikethru  =   0   'False
  13.    FontUnderline   =   0   'False
  14.    Height          =   5148
  15.    Left            =   420
  16.    LinkTopic       =   "Form1"
  17.    ScaleHeight     =   4404
  18.    ScaleWidth      =   8592
  19.    Top             =   1092
  20.    Width           =   8688
  21.    Begin MListBox MList4 
  22.       Alignment       =   0  'None
  23.       DefPicture      =   FORM1.FRX:0000
  24.       DrawRegions     =   1
  25.       Height          =   1524
  26.       ImageRegion     =   0
  27.       ImageType       =   3  'Aligned Bitmap
  28.       ItemHeight      =   300
  29.       ItemWidth       =   1500
  30.       Left            =   4944
  31.       MultiColumn     =   -1  'True
  32.       MultiSelect     =   0   'False
  33.       Sorted          =   0   'False
  34.       TabIndex        =   7
  35.       Top             =   2592
  36.       Width           =   3420
  37.    End
  38.    Begin MListBox MList3 
  39.       Alignment       =   1  'Left
  40.       DefPicture      =   FORM1.FRX:011A
  41.       DrawRegions     =   1
  42.       FontBold        =   0   'False
  43.       FontItalic      =   0   'False
  44.       FontName        =   "MS Sans Serif"
  45.       FontSize        =   9.6
  46.       FontStrikethru  =   0   'False
  47.       FontUnderline   =   0   'False
  48.       Height          =   1536
  49.       ImageRegion     =   0
  50.       ImageType       =   3  'Aligned Bitmap
  51.       ItemHeight      =   500
  52.       ItemWidth       =   780
  53.       Left            =   4944
  54.       MultiColumn     =   0   'False
  55.       MultiSelect     =   0   'False
  56.       Sorted          =   0   'False
  57.       TabIndex        =   4
  58.       Top             =   480
  59.       Width           =   3420
  60.    End
  61.    Begin MListBox MList2 
  62.       Alignment       =   0  'None
  63.       BackColor       =   &H00FFFF00&
  64.       DefPicture      =   FORM1.FRX:0234
  65.       DrawRegions     =   4
  66.       FontBold        =   0   'False
  67.       FontItalic      =   -1  'True
  68.       FontName        =   "MS Sans Serif"
  69.       FontSize        =   9.6
  70.       FontStrikethru  =   0   'False
  71.       FontUnderline   =   0   'False
  72.       ForeColor       =   &H00004080&
  73.       Height          =   1524
  74.       ImageRegion     =   1
  75.       ImageType       =   0  'None
  76.       ItemHeight      =   300
  77.       ItemWidth       =   780
  78.       Left            =   48
  79.       MultiColumn     =   0   'False
  80.       MultiSelect     =   0   'False
  81.       Sorted          =   0   'False
  82.       TabIndex        =   0
  83.       Top             =   2592
  84.       Width           =   4668
  85.    End
  86.    Begin MListBox MList1 
  87.       Alignment       =   0  'None
  88.       DrawRegions     =   3
  89.       Height          =   1752
  90.       ImageRegion     =   0
  91.       ImageType       =   0  'None
  92.       ItemHeight      =   195
  93.       ItemWidth       =   780
  94.       Left            =   48
  95.       MultiColumn     =   0   'False
  96.       MultiSelect     =   -1  'True
  97.       Sorted          =   -1  'True
  98.       TabIndex        =   1
  99.       Top             =   432
  100.       Width           =   4668
  101.    End
  102.    Begin Label Label4 
  103.       BorderStyle     =   1  'Fixed Single
  104.       Caption         =   "Multi-Column Style Bitmapped List Box"
  105.       Height          =   252
  106.       Left            =   4944
  107.       TabIndex        =   6
  108.       Top             =   2304
  109.       Width           =   3420
  110.    End
  111.    Begin Label Label3 
  112.       BorderStyle     =   1  'Fixed Single
  113.       Caption         =   "Bitmapped List Box"
  114.       Height          =   252
  115.       Left            =   4944
  116.       TabIndex        =   5
  117.       Top             =   144
  118.       Width           =   3420
  119.    End
  120.    Begin Image Image1 
  121.       Height          =   240
  122.       Left            =   96
  123.       Picture         =   FORM1.FRX:034E
  124.       Top             =   4176
  125.       Visible         =   0   'False
  126.       Width           =   180
  127.    End
  128.    Begin Label Label2 
  129.       BorderStyle     =   1  'Fixed Single
  130.       Caption         =   "Normal List Box - Color, Font, Bitmaps, CheckBoxes"
  131.       Height          =   252
  132.       Left            =   48
  133.       TabIndex        =   3
  134.       Top             =   2304
  135.       Width           =   4668
  136.    End
  137.    Begin Label Label1 
  138.       BorderStyle     =   1  'Fixed Single
  139.       Caption         =   "Multi-Select Sorted List Box"
  140.       Height          =   252
  141.       Left            =   48
  142.       TabIndex        =   2
  143.       Top             =   144
  144.       Width           =   4668
  145.    End
  146.    Begin Menu mnuMultiSelect 
  147.       Caption         =   "&Multi-Select"
  148.       Begin Menu mnuSelected 
  149.          Caption         =   "&Selected"
  150.       End
  151.       Begin Menu mnuMListCount 
  152.          Caption         =   "&ListCount"
  153.       End
  154.       Begin Menu mnuSelCount 
  155.          Caption         =   "Sel&Count"
  156.       End
  157.       Begin Menu mnuMListIndex 
  158.          Caption         =   "List&Index"
  159.       End
  160.       Begin Menu mnuRange 
  161.          Caption         =   "Select/&Deselect Range"
  162.       End
  163.    End
  164.    Begin Menu mnuNormal 
  165.       Caption         =   "&Normal"
  166.       Begin Menu mnuText 
  167.          Caption         =   "&Text"
  168.       End
  169.       Begin Menu mnuListCount 
  170.          Caption         =   "&ListCount"
  171.       End
  172.       Begin Menu mnuListIndex 
  173.          Caption         =   "List&Index"
  174.       End
  175.       Begin Menu mnuRegular 
  176.          Caption         =   "&Regular"
  177.       End
  178.       Begin Menu mnuBitmap 
  179.          Caption         =   "&Bitmap"
  180.       End
  181.       Begin Menu mnuCheckBox 
  182.          Caption         =   "&CheckBox"
  183.       End
  184.       Begin Menu mnuCheckRange 
  185.          Caption         =   "Check/&Uncheck Range"
  186.       End
  187.    End
  188.    Begin Menu mnuBitmapped 
  189.       Caption         =   "&Bitmapped"
  190.       Begin Menu mnuLeft 
  191.          Caption         =   "&Left"
  192.       End
  193.       Begin Menu mnuTop 
  194.          Caption         =   "&Top"
  195.       End
  196.       Begin Menu mnuRight 
  197.          Caption         =   "&Right"
  198.       End
  199.       Begin Menu mnuBottom 
  200.          Caption         =   "&Bottom"
  201.       End
  202.    End
  203.    Begin Menu mnuMisc 
  204.       Caption         =   "M&isc"
  205.       Begin Menu mnuItemData 
  206.          Caption         =   "&ItemData"
  207.       End
  208.       Begin Menu mnuTopIndex 
  209.          Caption         =   "&TopIndex"
  210.       End
  211.       Begin Menu mnuNewIndex 
  212.          Caption         =   "&NewIndex"
  213.       End
  214.       Begin Menu mnuList 
  215.          Caption         =   "&List"
  216.       End
  217.       Begin Menu mnuActiveRegion 
  218.          Caption         =   "&ActiveRegion"
  219.       End
  220.       Begin Menu mnuChecked 
  221.          Caption         =   "Checked"
  222.       End
  223.       Begin Menu mnuCheckItem2 
  224.          Caption         =   "Check Item 2"
  225.       End
  226.       Begin Menu mnuUncheckTwo 
  227.          Caption         =   "Uncheck Item Two"
  228.       End
  229.       Begin Menu mnuTest 
  230.          Caption         =   "Test Horz. Scroll Bar"
  231.       End
  232.       Begin Menu mnuRemoveItem 
  233.          Caption         =   "&Remove Item"
  234.       End
  235.       Begin Menu mnuMove 
  236.          Caption         =   "&Move"
  237.       End
  238.    End
  239. Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
  240. Const LB_SETCOLUMNWIDTH = &H400 + 22
  241. Sub Command1_Click ()
  242.   Debug.Print "MList1 Count:" + MList1.ListCount
  243. End Sub
  244. Sub Command2_Click ()
  245.   Debug.Print "MList1 SelCount: " + MList1.SelCount
  246. End Sub
  247. Sub Command4_Click ()
  248.   Debug.Print "MList2 Count: " + MList2.ListCount
  249. End Sub
  250. Sub Command5_Click ()
  251.   Debug.Print "MList2 Selected Text: " + MList2.Text
  252. End Sub
  253. Sub Command7_Click ()
  254.   MList2.TopIndex = 3
  255. End Sub
  256. Sub Command8_Click ()
  257.   Debug.Print "MList2.TopIndex = "; MList2.TopIndex
  258. End Sub
  259. Sub Form_Load ()
  260.   Const DT_RIGHT = 2
  261.   Const DT_VCENTER = 4
  262.   Const DT_SINGLELINE = 32
  263. ' Columns are separated by the Tab character
  264. ' We could set the number of columns ourselves by setting MList1.DrawRegions = ####
  265.   MList1.AddItem "Item1" + Chr$(9) + "Information One"
  266.   MList1.AddItem "Item2" + Chr$(9) + "Information Two"
  267.   MList1.AddItem "Item3" + Chr$(9) + "Information Three"
  268.   MList1.AddItem "Item4" + Chr$(9) + "Information Four"
  269.   MList1.AddItem "Item1" + Chr$(9) + "Information One"
  270.   MList1.AddItem "Item2" + Chr$(9) + "Information Two"
  271.   MList1.AddItem "Item3" + Chr$(9) + "Information Three"
  272.   MList1.AddItem "Item4" + Chr$(9) + "Information Four"
  273. ' Print the default flags for item 1
  274.   Debug.Print "Item1 DrawFlags: " + MList1.DrawFlags(1)
  275. ' When you set or change DrawRegions, the default flags are DT_LEFT + DT_VCENTER + DT_SINGLELINE
  276. ' You can set the flags to any legal value used by the Windows API call DrawText
  277. ' Change the dollar column to be right justified instead
  278.   MList2.DrawFlags(3) = DT_RIGHT + DT_VCENTER + DT_SINGLELINE
  279.   MList2.AddItem "Item1" + Chr$(9) + "Information One" + Chr$(9) + "$45.00"
  280.   MList2.AddItem "Item2" + Chr$(9) + "Information Two" + Chr$(9) + "$36.69"
  281.   MList2.AddItem "Item3" + Chr$(9) + "Information Three" + Chr$(9) + "$2234.00"
  282.   MList2.AddItem "Item4" + Chr$(9) + "Information Four" + Chr$(9) + "$4.00"
  283.   MList2.AddItem "Item5" + Chr$(9) + "Information Five" + Chr$(9) + "$0.25"
  284.   MList2.AddItem "Item1" + Chr$(9) + "Information One" + Chr$(9) + "$45.00"
  285.   MList2.AddItem "Item2" + Chr$(9) + "Information Two" + Chr$(9) + "$36.69"
  286.   MList2.AddItem "Item3" + Chr$(9) + "Information Three" + Chr$(9) + "$2234.00"
  287.   MList2.AddItem "Item4" + Chr$(9) + "Information Four" + Chr$(9) + "$4.00"
  288.   MList2.AddItem "Item5" + Chr$(9) + "Information Five" + Chr$(9) + "$0.25"
  289.   MList2.AddItem "Item1" + Chr$(9) + "Information One" + Chr$(9) + "$45.00"
  290.   MList2.AddItem "Item2" + Chr$(9) + "Information Two" + Chr$(9) + "$36.69"
  291.   MList2.AddItem "Item3" + Chr$(9) + "Information Three" + Chr$(9) + "$2234.00"
  292.   MList2.AddItem "Item4" + Chr$(9) + "Information Four" + Chr$(9) + "$4.00"
  293.   MList2.AddItem "Item5" + Chr$(9) + "Information Five" + Chr$(9) + "$0.25"
  294.   MList2.ItemLength(1) = 1000
  295.   MList2.ItemLength(2) = 1700
  296.   MList2.ItemLength(3) = 1300
  297.   MList2.ItemForeColor(1) = RGB(255, 255, 255)
  298.   MList2.ItemBkColor(1) = RGB(0, 0, 0)
  299.   MList2.ItemData(0) = 199
  300.   MList2.ItemData(1) = 200
  301.   MList2.ItemData(2) = 201
  302.   MList2.ItemData(3) = 202
  303.   MList2.ItemData(4) = 203
  304.   MList2.ItemData(5) = 204
  305.   MList2.ItemData(6) = 205
  306.   MList2.ItemData(7) = 206
  307.   MList2.ItemData(8) = 207
  308.   MList2.ItemData(9) = 208
  309.   MList2.ItemData(10) = 209
  310.   MList2.ItemData(11) = 210
  311.   MList2.ItemData(12) = 211
  312.   MList2.ItemData(13) = 212
  313.   MList2.ItemData(14) = 213
  314. ' Print the default flags for item 1
  315.   Debug.Print "Item3 DrawFlags: " + MList2.DrawFlags(3)
  316.   Debug.Print "ItemLength(2): "; MList2.ItemLength(2)
  317.   MList3.AddItem "Bitmap string one"
  318.   MList3.AddItem "Bitmap string two"
  319.   MList3.AddItem "Bitmap string three"
  320.   MList3.AddItem "Bitmap string four"
  321.   MList3.AddItem "Bitmap string five"
  322.   MList3.ItemPicture(1) = Image1.Picture
  323.   Dim X As Integer
  324.   For X = 1 To 20
  325.     MList4.AddItem "DOC" + Trim$(Str$(X)) + ".DOC"
  326.   Next X
  327.   MList4.ItemPicture(4) = Image1.Picture
  328.   ' X = SendMessage(MList4.hWnd, LB_SETCOLUMNWIDTH, 100, 0)
  329. End Sub
  330. Sub MList1_Click ()
  331. '  MsgBox "Multi-Select List Box Click", 0, "MList1"
  332. End Sub
  333. Sub MList1_DblClick ()
  334. '  MsgBox "Multi-Select List Box Double Click", 0, "MList1"
  335. End Sub
  336. Sub MList2_DblClick ()
  337.   If MList2.ImageType = 1 Then
  338.     If MList2.ItemPicture(MList2.ListIndex) <> Image1.Picture Then
  339.       MList2.ItemPicture(MList2.ListIndex) = Image1.Picture
  340.     Else
  341.       MList2.ItemPicture(MList2.ListIndex) = MList2.DefPicture
  342.     End If
  343.   End If
  344. End Sub
  345. Sub mnuActiveRegion_Click ()
  346.   MList2.ActiveRegion = 2
  347.   If MList2.ListIndex <> -1 Then
  348.     Dim aString As String
  349.     aString = "MList2.TextRegion = " + MList2.TextRegion
  350.     MsgBox aString, 0, "MList2"
  351.     MList2.TextRegion = "Replace"
  352.   End If
  353.   aString = "MList2.ListRegion(3) = " + MList2.ListRegion(3)
  354.   MsgBox aString, 0, "MList2"
  355.   MList2.ListRegion(3) = "Replace"
  356. End Sub
  357. Sub mnuBitmap_Click ()
  358.   MList2.ItemLength(1) = 300
  359.   MList2.ItemLength(2) = 1000
  360.   MList2.ItemLength(3) = 1700
  361.   MList2.ItemLength(4) = 1300
  362.   MList2.ItemPicture(1) = Image1.Picture
  363.   If MList2.ImageType <> 1 Then
  364.     MList2.ImageType = 1
  365.     MList2.Refresh
  366.     MList2.ItemBkColor(1) = MList2.BackColor
  367.     MList2.ItemForeColor(1) = MList2.ForeColor
  368.   End If
  369. End Sub
  370. Sub mnuBottom_Click ()
  371.   MList3.Alignment = 4
  372.   MList3.Refresh
  373. End Sub
  374. Sub mnuCheckBox_Click ()
  375.   MList2.ItemLength(1) = 300
  376.   MList2.ItemLength(2) = 1000
  377.   MList2.ItemLength(3) = 1700
  378.   MList2.ItemLength(4) = 1300
  379.   If MList2.ImageType <> 2 Then
  380.     MList2.ImageType = 2
  381.     MList2.Refresh
  382.     MList2.ItemBkColor(1) = MList2.BackColor
  383.     MList2.ItemForeColor(1) = MList2.ForeColor
  384.   End If
  385. End Sub
  386. Sub mnuChecked_Click ()
  387.   MList2.Checked(1) = True
  388.   Dim X%
  389.   For X% = 0 To MList2.ListCount - 1
  390.     If MList2.Checked(X%) Then
  391.       Debug.Print "MList2.Checked("; X%; ") = Checked"
  392.     Else
  393.       Debug.Print "MList2.Checked("; X%; ") = Unchecked"
  394.     End If
  395.   Next X%
  396. End Sub
  397. Sub mnuCheckItem2_Click ()
  398.   If MList2.ImageType = 2 Then
  399.     MList2.Checked(2) = True
  400.   End If
  401. End Sub
  402. Sub mnuCheckRange_Click ()
  403.   If MList2.ImageType = 2 Then
  404.     MList2.RangeStart = 0
  405.     MList2.RangeEnd = 3
  406.     If MList2.Checked(0) Then
  407.       MList2.RangeChecked = False
  408.     Else
  409.       MList2.RangeChecked = True
  410.     End If
  411.   End If
  412. End Sub
  413. Sub mnuItemData_Click ()
  414.   Dim Count As Integer
  415.   Dim X As Integer
  416.   Dim aString As String
  417.   Count = MList2.ListCount
  418.   For X = 0 To Count - 1
  419.     Debug.Print "ItemData" + Str$(X) + ": " + Str$(MList2.ItemData(X))
  420.   Next
  421. End Sub
  422. Sub mnuLeft_Click ()
  423.   MList3.Alignment = 1
  424.   MList3.Refresh
  425. End Sub
  426. Sub mnuList_Click ()
  427.   For I = 0 To MList2.ListCount - 1
  428.     Debug.Print I; " - "; MList2.List(I)
  429.   Next I
  430.   MList2.List(2) = "Rep" + Chr$(9) + "Replacement" + Chr$(9) + "$100.00"
  431. End Sub
  432. Sub mnuListCount_Click ()
  433.   Dim aString As String
  434.   aString = "MList2.ListCount = " + Str$(MList2.ListCount)
  435.   MsgBox aString, 0, "MList2"
  436. End Sub
  437. Sub mnuListIndex_Click ()
  438.   Dim aString As String
  439.   aString = "MList2.ListIndex = " + Str$(MList2.ListIndex)
  440.   MsgBox aString, 0, "MList2"
  441. End Sub
  442. Sub mnuMListCount_Click ()
  443.   Dim aString As String
  444.   aString = "MList1.ListCount = " + Str$(MList1.ListCount)
  445.   MsgBox aString, 0, "MList1"
  446. End Sub
  447. Sub mnuMListIndex_Click ()
  448.   Dim aString As String
  449.   aString = "MList1.ListIndex = " + Str$(MList1.ListIndex)
  450.   MsgBox aString, 0, "MList1"
  451. End Sub
  452. Sub mnuMove_Click ()
  453.   MList1.Move 0, 0
  454. End Sub
  455. Sub mnuMSText_Click ()
  456.   MsgBox MList1.Text, 0, "Text-MList1"
  457. End Sub
  458. Sub mnuNewIndex_Click ()
  459.   MList1.AddItem "Item21" + Chr$(9) + "Information TwoOne"
  460.   Dim aString As String
  461.   aString = "MList1.NewIndex = " + Str$(MList1.NewIndex)
  462.   MsgBox aString, 0, "MList1"
  463. End Sub
  464. Sub mnuRange_Click ()
  465.   MList1.RangeStart = 0
  466.   MList1.RangeEnd = 3
  467.   If MList1.Selected(1) Then
  468.     MList1.RangeSelected = False
  469.   Else
  470.     MList1.RangeSelected = True
  471.   End If
  472. End Sub
  473. Sub mnuRegular_Click ()
  474.   MList2.ItemLength(1) = 1000
  475.   MList2.ItemLength(2) = 1700
  476.   MList2.ItemLength(3) = 1300
  477.   If MList2.ImageType Then
  478.     MList2.ImageType = 0
  479.     MList2.Refresh
  480.     MList2.ItemForeColor(1) = RGB(255, 255, 255)
  481.     MList2.ItemBkColor(1) = RGB(0, 0, 0)
  482.   End If
  483. End Sub
  484. Sub mnuRemoveItem_Click ()
  485.   MList2.RemoveItem 2
  486. End Sub
  487. Sub mnuRight_Click ()
  488.   MList3.Alignment = 3
  489.   MList3.Refresh
  490. End Sub
  491. Sub mnuSelCount_Click ()
  492.   Dim aString As String
  493.   aString = "MList1.SelCount = " + Str$(MList1.SelCount)
  494.   MsgBox aString, 0, "MList1"
  495. End Sub
  496. Sub mnuSelected_Click ()
  497.   Dim Count As Integer
  498.   Dim X As Integer
  499.   Dim aString As String
  500.   Count = MList1.ListCount
  501.   If MList1.SelCount Then
  502.     For X = 0 To Count - 1
  503.       If MList1.Selected(X) Then
  504.         aString = "True"
  505.       Else
  506.         aString = "False"
  507.       End If
  508.       Debug.Print "Item" + Str$(X) + ": " + aString
  509.     Next
  510.   End If
  511. End Sub
  512. Sub mnuTest_Click ()
  513.   MList2.ItemLength(1) = 1000
  514.   MList2.ItemLength(2) = 1000
  515.   MList2.ItemLength(3) = 1700
  516.   MList2.ItemLength(4) = 1300
  517.   MList2.SetHzScroll = True
  518. End Sub
  519. Sub mnuText_Click ()
  520.   MsgBox MList2.Text, 0, "MList2"
  521. End Sub
  522. Sub mnuTop_Click ()
  523.   MList3.Alignment = 2
  524.   MList3.Refresh
  525. End Sub
  526. Sub mnuTopIndex_Click ()
  527.   MList2.TopIndex = 6
  528.   Dim aString As String
  529.   aString = "MList2.TopIndex = " + Str$(MList2.TopIndex)
  530.   MsgBox aString, 0, "MList2"
  531. End Sub
  532. Sub mnuUncheckTwo_Click ()
  533.   If MList2.ImageType = 2 Then
  534.     MList2.Checked(2) = False
  535.   End If
  536. End Sub
  537.